﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using RestBucks.Domain;

namespace RestBucks.Resources.Orders.Representations
{
    [XmlRoot(ElementName = "order", Namespace = "http://restbuckson.net")]
	public class OrderRepresentation : RepresentationBase
	{
	    public OrderRepresentation()
	    {
            Items = new List<OrderItemRepresentation>();
	    }

        [XmlElement(ElementName =  "location")]
        [JsonConverter(typeof(StringEnumConverter))]
	    public Location Location { get; set; }
        
        [XmlElement(ElementName = "cost")]
	    public decimal Cost { get; set; }

        [XmlArray(ElementName = "items"), XmlArrayItem(ElementName = "item")]
	    public List<OrderItemRepresentation> Items { get; set; }
        
        [XmlElement(ElementName = "status")]
        [JsonConverter(typeof(StringEnumConverter))]
        public OrderStatus Status { get; set; }
	}

}